package com.cnemc.docker.config;

import com.cnemc.docker.pool.DockerClientPool;
import com.cnemc.docker.service.DockerService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(DockerProperties.class)
public class DockerAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean
    public DockerClientPool dockerClientPool(DockerProperties properties) {
        return new DockerClientPool(properties);
    }

    @Bean
    @ConditionalOnMissingBean
    public DockerService dockerService(DockerClientPool dockerClientPool) {
        return new DockerService(dockerClientPool);
    }
} 